<script type="text/javascript">

    $(document).ready(function () {
        var login;
        $('.user_').mouseover(function () {
            login = $(this).text();
            $(this).css('color', '#000000');
            $(this).css('border-bottom', '1px dashed #ff9999');
            $(this).css('cursor', 'pointer');
        }).mouseout(function () {
                    $(this).css('color', 'gray');
                    $(this).css('border-bottom', '0px dotted #ccc');
                });

        $('.report_comment').click(function (e) {
            e.preventDefault();
            var comment_id = $(this).attr('id');
            this_comment = $(this);
            $.ajax({
                url:'<?= base_url();?>addcomment/report/' + comment_id,
                type:'POST',
                success:function (data) {
                    this_comment.hide().text('Nahlásené').fadeIn(500);
                    this_comment.css('color', '#cc6666');
                }
            });

            return false;

        });


        /// VECI NA ZOBRAZENIE 'NEVHODNEHO' textu...
        $('.batn').click(function (e) {
            e.preventDefault();
            $(this).hide();
            var aa = $(this).next().show();
            $('<span class="hideComment" style="color:gray;padding-left:6px;">Skryť</span>').appendTo(aa);
            return false;
        });

        $('.hideComment').live('click', function (e) {
            e.preventDefault();
            $(this).hide(); // skry text 'Skryť'
            $(this).parent().hide(); // skry zobrazeny text
            $(this).parent().prev().show(); // zobraz 'batn' - text indikujuci potcialne nevhodny prispevok
            return false;
        });


        $('.user_').each(function () {
            var link = $(this);
            link.qtip({
                content:{
                    url:"<?= base_url();?>profile/getUserReportsCountByLogin",
                    data:'login=' + link.text(),
                    method:'post'
                },
                show:{
                    effect:function (offset) {
                        $(this).slideDown(300); // "this" refers to the tooltip
                    },
                    solo:true
                },
                style:{
                    tip:{ // Now an object instead of a string
                        corner:'topLeft', // We declare our corner within the object using the corner sub-option
                        color:'#6fccff',
                        size:{
                            x:8, // Be careful that the x and y values refer to coordinates on screen, not height or width.
                            y:8 // Depending on which corner your tooltip is at, x and y could mean either height or width!
                        }
                    }, 'font-size':11, color:'#222222'  } });
        });
    });

</script>


<?php
$perm = base_url() . "css/images/link.png";
if (isset($comment_title)) {


    for ($i = 0; $i < count($comment_title); $i++) {
        echo "<div class='postNadpis'><h3><a name='" . url_title($comment_title[$i]) . "'></a>";
        echo ucfirst($comment_title[$i]) . "</h3> <span style='color: gray; font-size:11px;'> | <span class='user_'>" . $comment_author[$i] . "</span> | " . $comment_date[$i];
        if ($this->session->userdata("sess_login") != $comment_author[$i]) {
            echo ' | ' . $comment_reported[$i];
        }
        echo "</span></div>";
        echo "<span style='padding-left:22px;'>" . nl2br($comment_text[$i]);
        echo br(2);
    }
}

if (isset($other_comments)) {
    echo "<div style='border-bottom: 1px solid gray;margin-bottom: 12px;color: gray;'>";
    echo "<h2>Ostatné komentáre od užívateľov, viazané k udalostiam na tomto mieste</h2>";
    echo "</div>";
    for ($i = 0; $i < count($other_comment_type_id); $i++) {
        $img_url = base_url() . "css/images/" . $other_comment_pic[$i];
        echo "<div class='postNadpis'><h3>" . img(array('src' => $img_url, 'style' => 'border:none; vertical-align:middle;height:16px;')) . $other_comment_type_id[$i] . " | <a name='" . url_title($other_comment_title[$i]) . "'></a>";
        echo $other_comment_title[$i] . "</h3> <span style='color: gray; font-size:11px;'> | <span class='user_'>" . $other_comment_author[$i] . "</span> | " . $other_comment_date[$i];
        if ($this->session->userdata("sess_login") != $other_comment_author[$i]) {
            echo ' | Nahlásiťss';
        }
        echo "</span></div>";
        echo "<span style='padding-left:22px;'>" . $other_comment_text[$i];
        echo br(2);
    }
}
?>

	